package com.hzdl.car.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hzdl.car.bean.News;
import com.hzdl.car.mapper.NewsMapper;
import com.hzdl.car.service.NewsService;
import com.hzdl.car.vo.NewsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServiceimpl implements NewsService {
    @Autowired
    private NewsMapper mapper;

    @Override
    public PageInfo<News> findWhere(NewsVo newsVo) {
        PageHelper.startPage(newsVo.getPage(),newsVo.getLimit());
        List<News> list = mapper.findWhere(newsVo);
        return new PageInfo<>(list);
    }

    @Override
    public int add(NewsVo newsVo) {
        return mapper.add(newsVo);
    }

    @Override
    public int delete(Integer id) {
        return mapper.delete(id);
    }

    @Override
    public int update(NewsVo newsVo) {
        return mapper.update(newsVo);
    }

    @Override
    public List<News> findList() {
        return mapper.findList();
    }
}
